import { Getapplyapi, Modifyapi, Xuigaiapi, deletelist } from '../../api/audit/msbd'


export const state = () => ({
    tableData: [],
    uid: [],
    currentPage: 1,
    pageSize: 1,
    totle: 2,
    input: "ha",
})

export const mutations = {
    // 渲染列表
    dralist(state, data) {
        state.tableData = data
    },

    uidlist(state, data) {
        state.uid = data
    },

    currentPagelist(state, data) {
        state.currentPage = data
    },

    PageSizelist(state, data) {
        state.pageSize = data
    },

    // 总条数
    totlelist(state, data) {
        state.totle = data
    },

    inputlist(state, data) {
        state.input = data
    }
}

export const actions = {
    // 渲染获取数局
    async Getapply({ commit, state }, data) {
        let list;
        if (data) {
            list = await Getapplyapi({ searchVal: state.input })
        } else {
            list = await Getapplyapi({ currentPage: state.currentPage, pageSize: state.pageSize })
        }
        commit("dralist", list.data)
    },
    // 新增
    async Modify(context, data) {
        await Modifyapi(data)
        context.dispatch("Getapply")
    },
    // 修改
    async Xuigai(context, data) {
        await Xuigaiapi(data)
        context.dispatch("Getapply")
    },
    //删除 
    async deleteapi(context, data) {
        await deletelist(data)
        context.dispatch("Getapply")
    },
    //获取uid
    // async uidapi({ commit }) {
    //     let list = await uidlidt()
    //     commit("uidlist", list.classify)
    // },
    // 总条数
    // async totleget({ commit }) {
    //     let list = await totleStore()
    //     commit("totlelist", list.total)
    // },

}

// export const getters = {

// }